/**
 * @description 定义产品接口
 */
import { PRODUCT_LIST_URL,DICT_INFO_URL,FILE_UPLOAD_URL,PRODUCT_ADD_URL,PRODUCT_APPROVE_URL,PRODUCT_UPDATE_URL,PRODUCT_DETELE_URL,PRODUCT_APP_INFO_URL } from "@/config/urls.conf"
import ajax from "./ajax"

export function productListApi(params) {
    return ajax({
        url: PRODUCT_LIST_URL,
        params
    })
}

export function dictInfoApi(type) {
    return ajax({
        url:DICT_INFO_URL,
        method:'GET',
        params:{
            page:1,
            size:100,
            type
        }
    })
}

export function fileUploadApi(dir,file) {
    return ajax({
        url:FILE_UPLOAD_URL + dir,
        method:'POST',
        data:file
    })
}

export function productAddApi(data) {
    return ajax({
        url:PRODUCT_ADD_URL,
        method:'PUT',
        data
    })
}

export function productApproveApi(goods_id) {
    return ajax({
        url:PRODUCT_APPROVE_URL,
        method:'GET',
        params:{goods_id}
    })
}

export function productUpdateApi(data) {
    return ajax({
        url:PRODUCT_UPDATE_URL,
        method:'POST',
        data
    })
}

export function productDeleteApi(id) {
    return ajax({
        url:PRODUCT_DETELE_URL + id,
        method:'DELETE',
        data:id
    })
}

export function productAppInfoApi(data) {
    return ajax({
        url:PRODUCT_APP_INFO_URL,
        method:'POST',
        data
    })
}